package com.mostromas.ess.product.feign;

import com.mostromas.ess.feign.IFeignFileController;
import com.mostromas.ess.util.aliyun.AliyunUtil;
import com.mostromas.ess.util.base.Result;
import com.mostromas.ess.util.enums.PlatformEnum;
import com.mostromas.ess.util.properies.OSSProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class FeignFileController implements IFeignFileController {

    @Autowired
    private OSSProperties ossProperties;

    @Override
    public Result upload(MultipartFile file) {
        return AliyunUtil.uploadFileToOss(PlatformEnum.PROJECT, file, ossProperties.getAliyun());
    }

    @Override
    public Result delete(String fileUrl) {
        return AliyunUtil.delete(fileUrl, ossProperties.getAliyun());
    }
}
